<template>
  <div class="Chief-Thirteen" chief-style-set>
    <Title title='我的任务管理' more :isRouterJump='false' @MoreClick='handleMoreClick'></Title>
    <div class="content-h-auto Thirteen-box" chief-style-set>
      <el-tabs v-model="activeName" @tab-click="handleClick" style="height:100%;" >
        <el-tab-pane name="1">
          <span slot="label">承办<span> ( {{PrincipalList.length}} )</span></span>
            <div class="Box-item" v-for="(item,index) in PrincipalList" :key="index + 'PrincipalList'" :title="item.name" @click="itemClick(item)">· {{item.name}}</div>
        </el-tab-pane>
        <el-tab-pane name="2">
          <span slot="label">分配<span> ( {{AssignerList.length}} )</span></span>
          <div class="Box-item" v-for="(item,index) in AssignerList" :key="index + 'AssignerList'" :title="item.name"  @click="itemClick(item)">· {{item.name}}</div>
        </el-tab-pane>
        <el-tab-pane name="3">
          <span slot="label">监督<span> ( {{AuditorList.length}} )</span></span>
          <div class="Box-item" v-for="(item,index) in AuditorList" :key="index + 'AuditorList'" :title="item.name"  @click="itemClick(item)">· {{item.name}}</div>
        </el-tab-pane>
      </el-tabs>
    </div>

    <Dialog
      :dialogVisible.sync="showDialog"
      title="我的任务管理"
      :showToolBar="false"
      :fullscreen='true'
      @comfireFun="showDialog = false"
      @defineFun="showDialog = false"
      ref="portalDialog"
      width="50%"
    >
      <template slot="content">
        <iframe :src="DialogUrl" width="100%" height="100%" frameborder="0"></iframe>
      </template>
    </Dialog>
  </div>
</template>

<script>
import Title from "@/components/baseTitle";
import Dialog from "@/components/portalDialog";
import { getBiTaskDataVByPrincipal, getBiTaskDataVByAssigner, getBiTaskDataVByAuditor } from "@/api/portalChief";
export default {
  name: "Chief-Thirteen",
  components: {
    Title, Dialog
  },
  data () {
    return {
      activeName: "1",
      PrincipalList: [],
      AssignerList: [],
      AuditorList: [],
      showDialog: false,
      DialogUrl: ""
    };
  },
  created () {
    this.init();
  },
  methods: {
    init () {
      getBiTaskDataVByPrincipal().then(res => {
        if (res.status === 200) {
          this.PrincipalList = res.data.data;
        }
      });

      getBiTaskDataVByAssigner().then(res => {
        if (res.status === 200) {
          this.AssignerList = res.data.data;
        }
      });

      getBiTaskDataVByAuditor().then(res => {
        if (res.status === 200) {
          this.AuditorList = res.data.data;
        }
      });
    },
    handleClick (item) {
      console.log(item);
    },
    // 更多点击
    handleMoreClick () {
      this.DialogUrl = `http://hedaotest.gdpr.com/tgliangshu/a/sys/sso/thridAuthorization?system=PORTAL&authToken=${this.$store.state.user.access_token}&redirectUrl=http://hedaotest.gdpr.com/tgTaskManager/a/plantask/masterTask/toTaobaoTaskList`;
      this.showDialog = true;
    },

    // 列表item点击
    itemClick (item) {
      this.DialogUrl = `http://hedaotest.gdpr.com/tgTaskManager/work/#/index?id=${item.id}`;
      this.showDialog = true;
    }
  }
};
</script>

<style lang='less'>
.Chief-Thirteen{
  .Thirteen-box{
    overflow: hidden;
    .Box-item{
      padding: 1vh 0;
      font-size: 16px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      cursor: pointer;
    }
  }
}
</style>